home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Pascal Super Library
/
Pascal Super Library (CW International)(1997).bin
/
DELPHI32
/
SYS_TOOL
/
MULTI020
/
MULTI020.ZIP
/
MPLOOP.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1993-09-08
|
754b
|
39 lines
unit MPLoop; { multitasking Loop-back pipe device }
interface
uses multi, mpipes;
procedure AttachLoopback(a,b : pPipe);
{ Start loopback task which copies from b to a }
implementation
type
pPipeArray = array[0..1] of pPipe;
procedure Loopback(var m); far;
var
p : pPipeArray absolute m;
ch : char;
begin
t^.hasexit := true;
p[0]^.NewOutputTask;
p[1]^.NewInputTask;
repeat
ch := p[1]^.Get;
if t^.poisoned or p[0]^.Put(ch) then break
until false;
p[0]^.NoMoreOutput;
p[1]^.NoMoreInput;
freemem(@p,8)
end;
procedure AttachLoopback(a,b : pPipe);
var p : ^pPipeArray;
begin
getmem(p,8);
p^[0] := a; p^[1] := b;
Fork(Loopback,2048,p^{$IFDEF DEBUG},'Loopback'{$ENDIF})
end;
end.